home *** CD-ROM | disk | FTP | other *** search
- Path: hal.COM!spike
- From: spike@hal.com (Spike White)
- Newsgroups: comp.lang.apl,comp.lang.asm.x86,comp.lang.c,comp.lang.c++,comp.os.ms-windows.programmer.networks
- Subject: Re: API Call to Acquire Ethernet Address
- Date: 23 Feb 1996 17:11:05 GMT
- Organization: HAL Computer Systems, Inc.
- Message-ID: <4gksf9$jgl@news.hal.com>
- References: <4f0bml$lvd@noc.tor.hookup.net> <4fnm1j$52@ns2.emirates.net.ae> <4gi2fg$bcq@news.hal.com>
- NNTP-Posting-Host: zarathustra.hal.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Spike White (spike@hal.com) wrote:
- : Kannan (kannan@emirates.net.ae) wrote:
- : : patrick@xiris.com (Patrick Whittle) wrote:
-
- : : >I need access to an API call that will return the
- : : >ethernet address from a NIC. Many programs and
- : : >utilities I have used display the ethernet address
- : : >such as "arp -a" from the TCP/IP protocol siute.
-
- : : I too am interested in such a API call. please post it in this ng.
-
- : Good luck! I had to write such a function on various UNIX system we
- : ported to. I was hoping for something analogous to
- : gethostname()/gethostaddr(), but no such luck. Which is weird, because
- : I see a ether_ntoa() which is analogous to inet_ntoa().
-
- : Altogether, it's about 400 lines of code since it must be done different
- : ways on different platforms. For platforms that support a DLPI interface
- : to the ethernet h/w, it's reasonably portable. But quite low-level --
- : putting and getting STREAMS msgs.
-
- Someone wrote and gave me a clue for a *much* easier way to portably do
- it on any UNIX system. Do an 'arp -a' and parse the output, looking for
- your hostname. You can use gethostname() to get your hostname. You can only
- do 'arp' as root.
-
- It's been awhile since I've done any TCP/IP on a PC, but I seem to recall
- there was an 'arp' command there also.
-
- Spike
-
- --
- Spike White | spike@hal.com | Biker Nerds
- HaL Software Systems | '87 BMW K75S, DoD #1347 | From HaL
- Austin, TX | http://www.halsoft.com/users/spike/index.html
- Disclaimer: HaL, want me to speak for you? No, Dave...
-